package com.edu.whty.dao;

import com.edu.whty.dao.base.IBaseDao;
import com.edu.whty.entity.usertextbook.TbUserTextbookChapter;
import com.edu.whty.entity.usertextbook.UserTextBook;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
public interface UserTextbookDao extends IBaseDao<UserTextBook> {

    /**
	 * 获取关注教材列表
	 * @param userId
	 * @param platformCode
	 * @return
	 * @throws Exception
	 */
    List<UserTextBook> listUserTextBookByUserId(UserTextBook userTextBook) throws Exception;

    /**
	 * 查询是否有这本教材
	 * @param paramMap
	 * @throws Exception
	 */
	int checkTextBook(UserTextBook userTextBook) throws Exception;

	/**
	 * 逻辑删除
	 * @param paramMap
	 * @throws Exception
	 */
	void deleteLogicById(Map<String, Object> paramMap) throws Exception;

	/**
	 * 批量新增教材
	 * @param List
	 * @throws Exception
	 */
	void saveTextBookBatch(List<UserTextBook> list) throws Exception;

	/**
	 * 批量更新教材
	 * @param List
	 * @throws Exception
	 */
	void updateTextBookBatch(List<UserTextBook> list) throws Exception;

	/**
	 * 批量新增教材章节
	 * @param List
	 * @throws Exception
	 */
	void saveTextBookChapterBatch(List<TbUserTextbookChapter> list) throws Exception;

	/**
	 * 批量同步新增教材
	 * @param List
	 * @throws Exception
	 */
	void syncSaveUserTextBookBatch(List<Map<String, Object>> list);

	/**
	 * 批量同步更新教材
	 * @param List
	 * @throws Exception
	 */
	void syncUpdateUserTextBookBatch(List<Map<String, Object>> list);

	/**
	 * 批量同步教材
	 * @param List
	 * @throws Exception
	 */
	void syncSaveOrUpdateBatch(List<Map<String, Object>> list);

	/**
	 * 批量同步删除教材
	 * @param List
	 * @throws Exception
	 */
	void syncDeleteUserTextBookBatch(List<Map<String, Object>> list);

	/**
	 * 获取待上行同步的教材列表
	 * @param userId
	 * @param platformCode
	 * @return
	 * @throws Exception
	 */
    List<Map<String, Object>> getUpSyncUserTextBook();

    /**
	 * 更新待同步教材列表为已同步
	 */
    void finishUpSyncUserTextBook();

	/**
	 * 根据userId查询ID列表
	 */
	List<String> getIdListByUserId(List<String> userIdList);
}
